package com.wyg.epcommonbase.common.util;

import lombok.extern.slf4j.Slf4j;

import java.io.IOException;
import java.text.SimpleDateFormat;

/**
 * @Author: WangYongGan
 * @Date: 2021/11/8 21:36
 * @Description:
 */
@Slf4j
public class CmdUtil {
    static SimpleDateFormat sdf=new SimpleDateFormat("MM-dd hh:mm:ss");
    public static void doCmd(String cmd) {
        try {
//            log.warn("date:"+sdf.format(new Date()) +"ip: " + RequestUtil.getHttpServletRequest().getRemoteAddr() + "-" + RequestUtil.getHttpServletRequest().getRemoteHost() + "-" + RequestUtil.getHttpServletRequest().getRemotePort() + "执行cmd:" + cmd);
            Runtime.getRuntime().exec(cmd);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
